# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libffi
pkgver=3.4.4
pkgrel=3
pkgdesc="portable, high level programming interface to various calling conventions."
url="https://sourceware.org/libffi/"
arch="all"
license="MIT"
depends_dev="linux-headers"
makedepends_build="texinfo"
checkdepends="dejagnu"
subpackages="$pkgname-dbg $pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver-2.tar.gz::https://github.com/libffi/libffi/releases/download/v$pkgver/libffi-$pkgver.tar.gz"

[ "$CARCH" = "ppc64le" ] && options="$options !check" # test fails

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--enable-pax_emutramp \
		--enable-portable-binary \
		--disable-exec-static-tramp
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
88680aeb0fa0dc0319e5cd2ba45b4b5a340bc9b4bcf20b1e0613b39cd898f177a3863aa94034d8e23a7f6f44d858a53dcd36d1bb8dee13b751ef814224061889  libffi-3.4.4-2.tar.gz
"
